<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <title>企业开票收入与损益表季度对比分析</title>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px;">
            <h:form id="form" enctype="multipart/form-data">
                <p:growl id="msgs" showDetail="true"/>
                <p:focus for="id"/>
                <h:panelGrid style="font-weight: bold;font-size: 12px;">
                    <h:selectOneRadio id="radio" value="#{invIncGaiLosJDAnaAction.accordType}">
                        <f:selectItem itemLabel="发票" itemValue="fp"/>
                        <f:selectItem itemLabel="预售款" itemValue="ysk"/>
                        <p:ajax update=":form:tabSum"
                                listener="#{invIncGaiLosJDAnaAction.radioOnClickForAction()}"/>
                    </h:selectOneRadio>
                </h:panelGrid>
                <p:panel id="ppCondition" style="width: 100%">
                    <h:panelGrid columns="2" style="width: 100%">
                        <h:panelGrid id="pgCust" widgetVar="WvCust" columns="4" style="text-align: right;">
                            <h:outputLabel value="纳税人识别号:" for="id" style="font-weight: bold;"/>
                            <p:inputText id="id" value="#{invIncGaiLosJDAnaAction.queryCondition.taxerID}"/>

                            <h:outputLabel value="纳税人名称:" for="name" style="font-weight: bold;margin-left: 100px;"/>
                            <p:inputText id="name" value="#{invIncGaiLosJDAnaAction.queryCondition.taxerName}"/>

                        </h:panelGrid>
                        <h:panelGrid style="width:10%">
                            <p:commandButton id="qryBtn" value="查 询"
                                             actionListener="#{invIncGaiLosJDAnaAction.query()}"
                                             style="font-size: 14px;width: 80px;" update="tabSum,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>
                <p:dataTable id="tabSum" style="width:100%;"
                             value="#{invIncGaiLosJDAnaAction.invIncGaiLosJDAnaInfos}"
                             var="invIncGaiLosJDAnaInfo"
                             rowKey="#{invIncGaiLosJDAnaInfo.pkid}"
                             selectionMode="single"
                             selection="#{invIncGaiLosJDAnaAction.invIncGaiLosJDAnaInfoSelected}"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="15"
                             rowsPerPageTemplate="100,50,30,15,5"
                             emptyMessage="数据记录为空...">

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.NSRSBH}">
                        <f:facet name="header">
                            <h:outputText value="纳税人识别号"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.NSRSBH}"/>
                    </p:column>

                    <p:column style="text-align:center" filterBy="#{invIncGaiLosJDAnaInfo.NSRMC}"
                              filterMatchMode="contains">
                        <f:facet name="header">
                            <h:outputText value="纳税人名称"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.NSRMC}"/>
                    </p:column>

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.sss_q}">
                        <f:facet name="header">
                            <h:outputText value="起始日期"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.sss_q}">
                            <f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8" locale="cn"></f:convertDateTime>
                        </h:outputText>
                    </p:column>

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.sss_z}">
                        <f:facet name="header">
                            <h:outputText value="结束日期"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.sss_z}">
                            <f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8" locale="cn"></f:convertDateTime>
                        </h:outputText>
                    </p:column>

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.bys}">
                        <f:facet name="header">
                            <h:outputText value="本月数"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.bys}">
                            <f:convertNumber pattern="##################.##"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.fpyskPrice}">
                        <f:facet name="header">
                            <h:outputText value="发票(预收款)金额"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.fpyskPrice}">
                            <f:convertNumber pattern="##################.##"/>
                        </h:outputText>

                    </p:column>

                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.anaEquals}">
                        <f:facet name="header">
                            <h:outputText value="是否相等"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.anaEquals}">
                        </h:outputText>
                        <f:facet name="footer">
                            <h:outputText value="笔数：#{fn:length(invIncGaiLosJDAnaAction.invIncGaiLosJDAnaInfos)}"/>
                        </f:facet>
                    </p:column>
                    <p:column style="text-align:center" sortBy="#{invIncGaiLosJDAnaInfo.uninCostDiffer}">
                        <f:facet name="header">
                            <h:outputText value="差额"/>
                        </f:facet>
                        <h:outputText value="#{invIncGaiLosJDAnaInfo.uninCostDiffer}">
                            <f:convertNumber pattern="##################.##"/>
                        </h:outputText>
                        <f:facet name="footer">
                            <h:commandLink>
                                <h:outputText value="[导出数据]"/>
                                <p:dataExporter type="xls" target="tabSum" fileName="sybfx"/>
                            </h:commandLink>
                        </f:facet>
                    </p:column>
                </p:dataTable>
            </h:form>
        </div>
    </ui:define>
</ui:composition>

